package com.example.demo.test.selenium;

import com.example.demo.bean.entity.TTest;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.WebDriverWait;


public abstract class SeleniumAction {
    public WebDriver driver;
    public WebDriverWait wait;

    public void newInstance() {
        if (driver != null) {
            after();
        }
        before();
    }

    private void before() {
        driver = Chrome.getOneDriver();
        wait = new WebDriverWait(driver, 60);
    }

    public abstract void process(TTest info);

    public void run(TTest info) {
        before();
        process(info);
        after();
    }

    private void after() {
        driver.quit();

    }


}
